package com.tmeone.erpone.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.tmeone.erpone.entity.SCompany;
import com.tmeone.erpone.entity.SCompanys;
import com.tmeone.erpone.entity.TProduct;
import com.tmeone.erpone.mapper.SCompanyMapper;
import com.tmeone.erpone.mapper.SCompanysMapper;
import com.tmeone.erpone.service.ISCompanyService;
import com.tmeone.erpone.service.ISCompanysService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author tmeone
 * @since 2021-04-18
 */
@Service
public class SCompanysServiceImpl extends ServiceImpl<SCompanysMapper,SCompanys> implements ISCompanysService {

    @Autowired
    private SCompanysMapper companysMapper;

    @Override
    public String selectStaffNumber(String id) {
        return companysMapper.selectStaffNumber(id);
    }

    @Override
    public String selectStaffNumberYes(String id) {
        return companysMapper.selectStaffNumberYes(id);
    }

    @Override
    public IPage<SCompanys> getQiToCompany(IPage<SCompanys> page) {
        return companysMapper.companyByQiYe(page);
    }

    @Override
    public IPage<SCompanys> getQiToCompany2(Page<SCompanys> page, Integer role, String name, String faRen, String status) {
        if (role==1){
            //代理商
           return   companysMapper.companyByQiYeMoHu1(page,name,faRen,status);
        }else{
            //供应商
            return companysMapper.companyByQiYeMoHu2(page,name,faRen,status);
        }




    }

}